package com.crm.system.controller.user;

import com.crm.common.model.DataResponse;
import com.crm.common.model.DhResponse;
import com.crm.common.model.Enum.ResponseCodeEnum;
import com.crm.model.entity.sys.UserCare;
import com.crm.system.service.user.UserCareService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author:chaifuyou
 * @Date: 2021/5/24 9:34
 */
@RestController("/userCare")
@Slf4j
public class UserCareController {

    @Autowired
    private UserCareService userCareService;

    /**
     * 添加关注
     * @param careAccountId
     * @return
     */
    @PostMapping("/addUserCare")
    public DataResponse addUserCare(@RequestParam String careAccountId){
        userCareService.addUserCare(careAccountId);
        return new DhResponse(ResponseCodeEnum.OK.getResponseCode());
    }

    /**
     * 取消关注
     * @param careAccountId 被关注人id
     * @return
     */
    @PostMapping("/delUserCare")
    public DataResponse delUserCare(@RequestParam String careAccountId){
        userCareService.delUserCare(careAccountId);
        return new DhResponse(ResponseCodeEnum.OK.getResponseCode());
    }
}
